package com.tm.servicemsm.service;

import com.tm.servicemsm.demos.House;

import java.util.HashMap;
import java.util.Map;

/**
 * 2024/7/19 我的小区、房产管理、绑定业主、点赞评论、首页咨询 Cjj
 */
public class CommunityService {
 //模拟数据库存储房产信息
 private Map<String,House> houseDatabase=  new HashMap<String, House>();

//添加房产到小区
    public void addHouse(House house){
        houseDatabase.put(house.getHouseId(),house);
    }

 //业主绑定方法
    public void bindOwner(String houseId,String ownerName){
        House house = houseDatabase.get(houseId);
        if(house!=null){
            house.bindOwner(ownerName);
        }
    }

    //点赞方法
    public void praiseHouse(String houseId){
        House house = houseDatabase.get(houseId);
        if(house!=null){
            house.praise();
        }
    }

    //留言评论方法
    public void commentHouse(String houseId,String comment){
       House house= houseDatabase.get(houseId);
       if(house!=null){
           house.comment(comment);
       }
    }
}
